<%@page import="com.Util.LMSUtil"%>
<%@page import="com.bean.LeaveDetailsBean"%>
<%@page import="com.bean.EmployeeBean"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>LEaveReport</title>
</head>

<body>
<div id="LeaveReport">
<%
	if(request.getAttribute("error") !=null && !request.getAttribute("error").equals("") ){
%>
<br>
<table border="0" cellpadding="0" cellspacing="0" width="650" align="center">
	<tr bgcolor="#aaaaaa">
		<td align="center">

		<table cellspacing="1" cellpadding="4" border="0" width="650">
			<tr>
				<td bgcolor="#004080" align="center" colspan=""><font
					face="Arial" size="3" color="RED" style="font-size: 15px;">
				<b> ERROR : <%=request.getAttribute("error") %></b> </font></td>
			</tr>

			<tr>
				<td bgcolor="#ececec" align="center"><font face="Verdana"
					size="5" style="font-size: 20px; "> <marquee><font color="blue">There was a problem in last operation</font></marquee> </font></td>
			</tr>
		</table>
		</td>
	</tr>
</table>
<br>
<%} %>
<%
	if(request.getAttribute("Message") !=null && !request.getAttribute("Message").equals("") ){
%>
<br>
<table border="0" cellpadding="0" cellspacing="0" width="650" align="center">
	<tr bgcolor="#aaaaaa">
		<td align="center">

		<table cellspacing="1" cellpadding="4" border="0" width="650">
			<tr>
				<td bgcolor="Green" align="center" colspan=""><font
					face="Arial" size="3" color="White" style="font-size: 15px;">
				<b>  <%=request.getAttribute("Message") %></b> </font></td>
			</tr>
		</table>
		</td>
	</tr>
</table>
<br>
<%} %>
<form action="/LMS/LeaveReportServlet?MODO=formSubmit" name="LeaveReportForm" method="post">
<% List<EmployeeBean> empList = (List<EmployeeBean>)request.getAttribute("empList") ;
  List<LeaveDetailsBean> leaveList = (List<LeaveDetailsBean>)request.getAttribute("leaveList") ;
  String empName = (String)request.getAttribute("empName");	
 %>
<table border="0" cellpadding="0" cellspacing="0" width="80%" align="left">
	<tr>
		<td bgcolor="#004080" align="center" colspan="2"><font
			face="Arial" size="3" color="white" style="font-size: 15px;">
		<b>Leave Report </b> </font></td>
	</tr>
	<tr>
		<td bgcolor="#cccccc" align="center">
			<select name="employee">
					<% for(EmployeeBean bean : empList){ %>
					<option value="<%=bean.getEmpId()%>"> <%=bean.getEmpName()%></option>
					<% }%>
				</select> &nbsp;
				<select name="leaveType">
					<option value="CL"> Causal Leave</option>
					<option value="EL"> Earned Leave</option>
					<option value="SL">Sick Leave</option>
				</select>
		</td>
		<td bgcolor="#cccccc" align="right">
			<input type="Submit"
					value="Report" style="font-size: 15px; font-family: Verdana">
		</td>
	</tr>
</table>
<br><br>
<%if(leaveList!= null && !leaveList.isEmpty()) {%>
<table border="0" cellpadding="0" cellspacing="0" width="80%" align="center">
	<tr>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td bgcolor="#004080"><font
			face="Arial" size="3" color="white" style="font-size: 15px;">
		<b>Leave Report Details</b> </font></td>
	</tr>
	<tr>
		<td>
			<table border="2" cellpadding="0" cellspacing="0">
				<tr>
					<th>Employee Name</th>
					<th>Leave Start Date</th>
					<th>Leave End Date</th>
					<th>Total number of days</th>
					<th>Reason</th>
				</tr>
				<%for(LeaveDetailsBean detailView : leaveList){ %>
					<tr>
						<td align="center"> <%=empName%></td>
						<td align="center"> <%=LMSUtil.getDateinString(detailView.getStartDate())%></td>
						<td align="center"> <%=LMSUtil.getDateinString(detailView.getEndDate())%></td>
						<td align="center"> <%=detailView.getNoOfDays()%></td>
						<td align="center"> <%=detailView.getReason()%></td>
					</tr>
				<%} %>
			</table>
		</td>
	</tr>
</table>
<%} %>


</form>
</div>
</body>
</html>